package common

import (
	"crypto/md5"
	"fmt"
	"strconv"
	"strings"
	"time"
)

func md5String(args ...string) string {
	str := strings.Join(args, "")
	data := []byte(str)
	has := md5.Sum(data)
	md5str := fmt.Sprintf("%x", has)
	return md5str
}

func MakeLoginToken(userName string, loginKey string) string {
	curTimeStr := strconv.FormatInt(time.Now().Unix(), 10)
	return md5String(userName, curTimeStr, loginKey)
}
